package pathfind;

/**
 * @author sad
 */
public class AStarPath<T> implements Comparable {
    public T point;
    public double f;
    public double g;
    public AStarPath parent;

    public AStarPath() {
        parent = null;
        point = null;
        g = f = 0.0;
    }

    public AStarPath(AStarPath p) {
        parent = p;
        g = p.g;
        f = p.f;
    }

    /**
     * Compare to another object using the total cost f.
     *
     * @param o The object to compare to.
     * @see Comparable#compareTo()
     * @return <code>less than 0</code> This object is smaller *
     * than <code>0</code>; <code>0</code> Object are the same.
     * <code>bigger than 0</code> This object is bigger than o.
     */
    @Override
    public int compareTo(Object o) {
        AStarPath p = (AStarPath) o;
        return (int) (f - p.f);
    }

    /**
     * Get the last point on the path.
     *
     * @return The last point visited by the path.
     */
    public T getPoint() {
        return point;
    }

    /**
     * Set the
     */
    public void setPoint(T p) {
        point = p;
    }

}
